package org.codingq92;

import org.codingq92.hand.CustomHashMap;
import org.codingq92.hand.CustomThreadPool;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.TimeUnit;

/**
 * @Author: CodingQ92
 * @Date: 2025/5/14 20:54
 */
public class TestMine {
    public static void main(String[] args) {
//        testMyThreadPool();
        testCustomerHashMap();

        List<String> list = new ArrayList<>();
        list.add("a");
    }

    private static void testCustomerHashMap() {
        CustomHashMap<String, String> customHashMap = new CustomHashMap<>();
        int count = 100000;
        for (int i = 0; i < count; i++) {
            customHashMap.put(String.valueOf(i), String.valueOf(i));
        }

        System.out.println(count);
        System.out.println(customHashMap.size());

        customHashMap.remove("8");
        System.out.println(customHashMap.get("8"));

        System.out.println(count - 1);
        System.out.println(customHashMap.size());
    }

    private static void testMyThreadPool() {
        CustomThreadPool threadPool = new CustomThreadPool(2, 4, 500, TimeUnit.MICROSECONDS,
                new ArrayBlockingQueue<>(2));
        for (int i = 0; i < 6; i++) {
            threadPool.execute(() -> {
                try {
                    Thread.sleep(1000);
                    System.out.println(Thread.currentThread().getName());
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            });
        }
    }
}
